﻿<cfsilent>
	<cfscript>
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		
		timeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		
		taskProp = getProperty("serviceFactory").getBean("taskPropertyAdvice");
		chooseProp = getProperty("serviceFactory").getBean("choosePropertyAdvice");
		
		taskId = event.getArg("TSK");
		taskType = event.getArg("TT");
		termId = event.getArg("TermID", event.getArg("TID"));
		

		/* 选课数据 */
		sql = "	SELECT
					stu.stu_id,stu.stu_name,
					(SELECT t_class.cls_name FROM t_class WHERE t_class.cls_id =  stu.cls_id ) cls_name ,
					sc.st,sc.choose_time,sc.retaking,sc.choose_prop,sc.retaking,
					sc.scc_id,c.cid,sc.task_type,sc.task_id
				FROM
					t_student_course sc 
					INNER JOIN t_student stu ON stu.stu_id = sc.stu_id 
					INNER JOIN t_course c ON sc.cid = c.cid
				WHERE
					sc.task_id = :taskId 
				ORDER BY
					stu.stu_id";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam(name = "taskId", value = taskId, cfsqltype = "cf_sql_varchar");
		rs_chooser = queryObj.execute(sql = sql).getResult();
		
		
		switch(taskType){
			case "P":
				sql = "	SELECT
							t.task_prop
						FROM
							t_task t
						WHERE
							t.tsk_id = :taskId ";
				break;
			case "C":
				sql = "	SELECT
							t.task_prop
						FROM
							t_common_task t
						WHERE
							t.tsk_id = :taskId ";
				break;
				
			case "R":
				sql = "	SELECT
							t.task_prop
						FROM
							t_reopen_task t
						WHERE
							t.tsk_id = :taskId ";
				break;
				
			case "T":
				sql = "	SELECT
							t.task_prop
						FROM
							t_sport_task t
						WHERE
							t.tsk_id = :taskId ";
				break;
				
		}

		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam(name = "taskId", value = taskId, cfsqltype = "cf_sql_varchar");
		rs_taskEntity = queryObj.execute(sql = sql).getResult();
		
		taskProp.parseProperty( rs_taskEntity.task_prop );
		
	</cfscript>
</cfsilent>

<cfif rs_chooser.recordCount>

	<table class="UIEditable">
		<thead>
			<tr>
				<td width="30"></td>
				<td>学号</td>
				<td>姓名</td>
				<td>班级</td>
				<td width="50">修读方式</td>
				<td width="75">选课时间</td>
				<!---<td width="60">学费状态</td>--->
				<td width="18"></td>
			</tr>
		</thead>
		<tbody>
			<cfset row = 0 />
		
            <cfloop query="rs_chooser">
				<cfset row ++ />
				<cfset chooseProp.parseProperty( rs_chooser.choose_prop ) />
				<tr class="editRows <cfif rs_chooser.retaking eq "1">noticeRow1</cfif>">
					<td><span class="index"><cfoutput>#row#</cfoutput></span></td>
					<td><span class="numeric"><cfoutput>#rs_chooser.stu_id#</cfoutput></span></td>
					<td><cfoutput>#rs_chooser.stu_name#</cfoutput></td>
					<td><cfoutput>#rs_chooser.cls_name#</cfoutput></td>
					<td><cfoutput>#dictAdvice.getStudyType(rs_chooser.st)#</cfoutput></td>
					<td><span class="numeric"><cfoutput>#timeAdvice.formatDatetimeString(rs_chooser.choose_time, 'MM/DD HH:MI')#</cfoutput></span></td>
					<!---<td>
						<cfif chooseProp.getPrePaid()>预收
							<cfelseif chooseProp.getPaid()>已缴清
							<cfelse>未交
						</cfif>
					</td>0--->
					<td>
						<cfif taskProp.getDischarge()>
							<span title="该教学班禁止退课" class="stat locked"></span>
							<cfelse>
							<a title="撤销课程" class="stat delete" href="javascript:removeTask('<cfoutput>#rs_chooser.scc_id#</cfoutput>','<cfoutput>#rs_chooser.cid#</cfoutput>','<cfoutput>#rs_chooser.stu_id#</cfoutput>','<cfoutput>#termId#</cfoutput>','<cfoutput>#rs_chooser.task_type#</cfoutput>','<cfoutput>#rs_chooser.task_id#</cfoutput>');"></a>
						</cfif>
					</td>
				</tr>
			</cfloop>
			<!--- javascript:removeTask(chooserId, courseId, stuId, termId, taskType, taskId); --->
		</tbody>
	</table>

	<cfelse>
	
	<div class="systemNotice">
		<p>没有选课学生名单</p>
	</div>
	
</cfif>